package pilgun.eshop.domain;

public class ItemTuple{
	public final Item item;
	public final int stock;
	public ItemTuple(Item item, int stock) {
		this.item = item;
		this.stock = stock;
	}
	public String toString(){
		return "("+item+", "+stock+")";
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((item == null) ? 0 : item.hashCode());
		result = prime * result + stock;
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj){
			return true;
		}
		if (obj == null){
			return false;
		}
		if (getClass() != obj.getClass()){
			return false;
		}
		ItemTuple other = (ItemTuple) obj;
		if (item == null) {
			if (other.item != null){
				return false;
			}
		}else{
			if (!item.equals(other.item)){
				return false;
			}
		}
		if (stock != other.stock){
			return false;
		}
		return true;
	}
}
